package model;

import java.io.Serializable;
import java.util.List;
import java.util.UUID;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Version;


/**
 * The persistent class for the station database table.
 * 
 */
@Entity
@NamedQuery(name= "Station.findStationByName", query="select s from Station s where s.stationName = :stationName")
public class Station implements Serializable {
	private static final long serialVersionUID = 1L;

	public static final String FIND_BY_NAME = "Station.findStationByName";
	
	@Id
	private int stationID = Math.abs(UUID.randomUUID().hashCode());

	private String stationName;
	
	private int version;

	//bi-directional many-to-one association to Schedule
	@OneToMany(mappedBy="station1", cascade = CascadeType.ALL, orphanRemoval = true)
	private List<Schedule> schedules1;

	//bi-directional many-to-one association to Schedule
	@OneToMany(mappedBy="station2", cascade = CascadeType.ALL, orphanRemoval = true)
	private List<Schedule> schedules2;

	public Station() {
	}

	public int getStationID() {
		return this.stationID;
	}

	public void setStationID(int stationID) {
		this.stationID = stationID;
	}

	
	public String getStationName() {
		return this.stationName;
	}

	public void setStationName(String stationName) {
		this.stationName = stationName;
	}

	public List<Schedule> getSchedules1() {
		return this.schedules1;
	}

	public void setSchedules1(List<Schedule> schedules1) {
		this.schedules1 = schedules1;
	}

	public List<Schedule> getSchedules2() {
		return this.schedules2;
	}

	public void setSchedules2(List<Schedule> schedules2) {
		this.schedules2 = schedules2;
	}

	@Version
	public int getVersion() {
		return version;
	}

	@Version
	public void setVersion(int version) {
		this.version = version;
	}

}